﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using BurzaConsole.Entities;

namespace BurzaConsole
{
    public class FileLoader
    {
        private const string FilePath = "C:\\Users\\Vladino\\Desktop\\BurzaConsole\\.mtgoxEUR.csv";

        public static IEnumerable<Ticker> LoadTickersFromFile()
        {
            return from line in File.ReadAllLines(FilePath)
                   let columns = line.Split(',')
                   select new Ticker
                   {
                       TimeStamp = Convert.ToInt32(columns[0]),
                       Kurz = double.Parse(columns[1], System.Globalization.CultureInfo.InvariantCulture)
                   };
        }
    }
}
